/*
 * @Author: your name
 * @Date: 2020-08-12 10:04:00
 * @LastEditTime: 2020-08-12 16:43:03
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \shici_demo\assets\Script\result\result.ts
 */

const {ccclass, property} = cc._decorator;

@ccclass
export class Result extends cc.Component {
    
    @property(cc.Node)
    public resultNode: cc.Node = null;                  // 结算界面
    @property(cc.Label)
    public levelLabel: cc.Label = null;                 // 关卡label
    @property(cc.Label)
    public titleLabel: cc.Label = null;                 // 标题label
    @property(cc.Label)
    public authorLabel: cc.Label = null;                // 朝代作者label
    @property(cc.Label)
    public poemLabel: cc.Label = null;                  // 诗句label

    public setLevelLabel(lv: number) {
        this.levelLabel.string = `第 ${lv} 关`;
    }

    public setPoemInfo(title: string, author: string, dynasty: string, poem: string): void {
        this.titleLabel.string = title;
        this.authorLabel.string = `[${dynasty}]${author}`;
        let _arr: Array<string> = poem.split("。");
        let _str: string = "";
        for (let i = 0; i < _arr.length; i++) {
            _str += _arr[i] + '\n';
        }
        this.poemLabel.string = _str;
    }

}
